//
//  NSString+Extentsion.m
//

#import "NSString+Extentsion.h"

@implementation NSString (Extentsion)

///字符串转字典
-(NSDictionary *)toDictionary{
    NSData *turnData = [self dataUsingEncoding:NSUTF8StringEncoding];
    NSDictionary *turnDic = [NSJSONSerialization JSONObjectWithData:turnData options:NSJSONReadingMutableLeaves error:nil];
    return turnDic;
}


///判断字符串是否为空
-(BOOL)isEmpty{
    if (self == nil || self == NULL) {
        return YES;
    }
    if ([self isKindOfClass:[NSNull class]]) {
        return YES;
    }
    if ([self isEqualToString:@"(null)"] || [self isEqualToString:@"null"]) {
        return YES;
    }
    if ([[self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0) {
        return YES;
    }
    if (self.length <= 0) {
        return YES;
    }
    return NO;
}



@end
